<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class ProductRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'title' => 'required',
            'keywords' => 'required',
            'product_name' => 'required',
            'product_img' => 'required',
        ];
    }

    /**
     * 错误返回消息
     *
     * @return array
     */
    public function messages()
    {
        return [
            'title.required' => '请设置SEO Title',
            'keywords.required' => '请设置SEO Keywords',
            'product_name.required' => '没有标题',
            'product_img.required' => '没有缩略图',
        ];
    }
}
